package sbpme.designer.parts;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

import sbpme.designer.model.AutoActivity;
import sbpme.designer.model.EndActivity;
import sbpme.designer.model.ExternalActivity;
import sbpme.designer.model.ProcessDiagram;
import sbpme.designer.model.StartActivity;
import sbpme.designer.model.Transition;

public class EditorPartsFactory implements EditPartFactory {

	public EditPart createEditPart(EditPart context, Object model) {
		EditPart part = null;
		if (model instanceof ProcessDiagram)
			part = new ProcessDiagramPart();
		else if (model instanceof StartActivity)
			part = new GenericActivityPart("start");
		else if (model instanceof EndActivity)
			part = new GenericActivityPart("end");
		else if (model instanceof AutoActivity)
			part = new GenericActivityPart("auto");
		else if (model instanceof ExternalActivity)
			part = new GenericActivityPart("external");
		else if (model instanceof Transition)
			part = new TransitionPart();
		part.setModel(model);
		return part;
	}

}
